﻿using Common.Extensions.OrderBy;
using DomainModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace IManager
{
    public interface IManagerContent
    {
        /// <summary>
        /// 通过Id获取
        /// </summary>
        /// <param name="articleId">Id</param>
        /// <returns>ArticleInfo</returns>
        ArticleInfo GetArticle(int articleId);

        /// <summary>
        /// 添加信息
        /// </summary>
        /// <param name="article">信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool AddContent(ArticleInfo article);


        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name="articleIdList">Id列表</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool DeleteContent(IList<int> articleIdList);


        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name="article">信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool UpdateContent(ArticleInfo article);


        /// <summary>
        /// 根据条件分页获得记录
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页大小</param>
        /// <param name="orderByExpressions">排序字段</param>
        /// <returns>记录列表</returns>
        IList<ArticleInfo> LoadAll(Expression<Func<ArticleInfo, bool>> where,
                                                   int pageIndex,
                                                   int pageSize,
                                                   params IOrderByExpression<ArticleInfo>[] orderByExpressions);


        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns>记录总数</returns>
        int LoadCount(Expression<Func<ArticleInfo, bool>> where);

    }
}
